package org.jeecg.flowable.mapper.task;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.flowable.entity.task.BpmTaskExt;

import java.util.Collection;
import java.util.List;

@Mapper
public interface BpmTaskExtMapper extends BaseMapper<BpmTaskExt> {

    default void updateByTaskId(BpmTaskExt entity) {
        update(entity, new LambdaQueryWrapper<BpmTaskExt>().eq(BpmTaskExt::getTaskId, entity.getTaskId()));
    }

    default List<BpmTaskExt> selectListByTaskIds(Collection<String> taskIds) {
        LambdaQueryWrapper<BpmTaskExt> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(BpmTaskExt::getTaskId, taskIds);
        return selectList(queryWrapper);
    }

    default BpmTaskExt selectByTaskId(String taskId) {
        LambdaQueryWrapper<BpmTaskExt> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(BpmTaskExt::getTaskId, taskId);
        return selectOne(queryWrapper);
    }

}
